env.setErrorMessageBoxEnabled(false)
local event_kill = EVENTHANDLER:New()

event_kill:HandleEvent( EVENTS.Kill )

function event_kill:OnEventKill(EventData)
    local inicoalition = EventData.TgtCoalition
    if inicoalition == coalition.side.RED and EventData.IniPlayerName ~= nil then -- if coalition is red
        local iniunit = EventData.IniUnitName
        local typeName = EventData.TgtTypeName
        local playerUcid = NET:New():GetPlayerUCID(nil, EventData.IniPlayerName)
        local url  = "http://localhost:8079/api/player/kill"
        local params = "ucid=" .. tostring(playerUcid) .. "&typeName=" .. typeName
        MESSAGE:New(SendRequest(url, params), 10, "数据库"):ToUnit(EventData.IniUnit)
    end

end


